import pymysql
class DB:
    def __init__(self):
        self.conn=pymysql.connect(host='localhost',port=3306,user='root',password='root',db='test',charset='utf8',cursorclass=pymysql.cursors.DictCursor)
        self.cursor=self.conn.cursor()
    
    def insert(self,sql):
        self.cursor.execute(sql)
        self.conn.commit()

    def find(self,sql):
        self.cursor.execute(sql)
        return self.cursor.fetchone()

db1=DB()    